package com.ktjy.t382.ch01.pojo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class PageInformations implements Serializable {
    private Integer pageNo = 1;  // 当前页码
    private Integer pageSize = 3;  // 每页显示的数据行数
    private Integer totalCount;  //总的记录数
    private Integer totalPageCount; //总页数
    private List<Informations> list = new ArrayList<>();


    public PageInformations(Integer pageNo, Integer pageSize, Integer totalCount, Integer totalPageCount, List<Informations> list) {
        this.pageNo = pageNo;
        this.pageSize = pageSize;
        this.totalCount = totalCount;
        this.totalPageCount = totalPageCount;
        this.list = list;
    }


    public PageInformations() {


    }


    public Integer getPageNo() {
        return pageNo;
    }


    public void setPageNo(Integer pageNo) {
        this.pageNo = pageNo;
    }


    public Integer getPageSize() {
        return pageSize;
    }


    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }


    public Integer getTotalCount() {
        return totalCount;
    }


    public void setTotalCount(Integer totalCount) {
        this.totalCount = totalCount;
        // 计算总页数
        if (this.totalCount % pageSize == 0) {
            this.totalPageCount = this.totalCount / pageSize;
        } else {
            this.totalPageCount = (this.totalCount / pageSize) + 1;
        }
    }


    public Integer getTotalPageCount() {
        return totalPageCount;
    }


    public void setTotalPageCount(Integer totalPageCount) {
        this.totalPageCount = totalPageCount;
    }


    public List<Informations> getList() {
        return list;
    }


    public void setList(List<Informations> list) {
        this.list = list;
    }
}
